import req from '@/untils/request'
import * as URL from '@/constants/api.js';

export function getSuggestionList(searchValue) {
  return req({
    url: URL.SUGGESTION_LIST,
    params: {
      q: searchValue,
    }
  })
    .then((res) => res.data.data.options.filter(o => o?.trim()))
    .catch(() => [])
}
export function getSearchResult(id) {
  return req({
    url: URL.Search_RESULT,
    params: {
      article_id: id,
    }
  })
    .then((res) => res.data.data.results)
    .catch(() => null)
}
